package com.jd.dao;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import com.jd.tools.FileTool;



public class GetProjectListDAOImpl implements GetProjectListDAO {
	private FileTool fileTool;
	
	@Override
	public List<String> queryByUserGroup(String userGroup,String tOrb) throws IOException {
		List<String> list;
		List<String> filteredList = new ArrayList<String>();
		list = fileTool.getFileNames();
		if(list.size() == 0) {
			return null;
		} else {
			for(String filename : list) {
				String[] s = filename.split("-");
				if(s[0].equalsIgnoreCase(userGroup)&&s[1].equalsIgnoreCase(tOrb)) {
					filteredList.add(filename);
				}
			}
			return filteredList;
		}
	}

	public void setFileTool(FileTool fileTool) {
		this.fileTool = fileTool;
	}

	public FileTool getFileTool() {
		return fileTool;
	}

}
